<script>
	export default {
		onShow: function() {
			uni.getSystemInfo({
				success: (res) => {
					const model = ['X', 'XR', 'XS', '11', '12', '13', '14', '15'];
					model.forEach(item => {
						//适配iphoneX以上的底部，给tabbar一定高度的padding-bottom
						if (res.model.indexOf(item) != -1 && res.model.indexOf('iPhone') != -1) {
							this.globalData.paddingBottomHeight = 40;
						}
					})
				}
			});
			this.globalData.recorderManager = uni.getRecorderManager();
			this.globalData.recorderManager.onStart(function(res) {
				console.log('开始录音');
			})

			this.globalData.recorderManager.onStop(function(data) {
				console.log('录音结束' + JSON.stringify(data));
				uni.$emit('globalEvent', {
					type: 'stop',
					data
				});
			})
		},
		globalData: {
			userInfo: null,
			recorderManager: null,
			paddingBottomHeight: 0
		}
	}
</script>

<style>
	page {
		background-color: #f9f9f9;
	}
</style>